<?php
// 本类由系统自动生成，仅供测试用途
namespace Admin\Controller;
use Think\Controller;
class MangController extends CommonController {
    public function index(){
              $Data= M('goods');
              $result1= $Data->order('date desc')->select(); 
              $this->assign('page',$result1);//留言总数
             $this->display();
    }
 public function del(){
     
       $m=M('goods');
			 $id=$_GET['id'];
			 $count=$m->delete($id);
			if($count>0){
				$this->success('数据删除成功');
			}else{
				$this->error('数据删除失败');
			}
        
    }        
  public function modify()
     {        
               if(IS_POST)
     {        
            
                $m=M('goods');
                $data['id']=$_POST['id'];
                //$this->success('数据修改成功','index');
                $data['comment']=$_POST['comment'];
                $data['name']=$_POST['name'];
                 $data['type']=$_POST['type'];
                  $data['down']=$_POST['down'];
                  $data['pass']=$_POST['pass'];
                $count=$m->save($data);
                if($count>0){
                  $this->ajaxReturn("修改数据成功 !",'eval');
                  }else{
                  $this->ajaxReturn("修改失败！",'eval');
             }
      } elseif(IS_GET){
        $m=M('goods');
        $id['id']=$_GET['id'];
        $data=$m->where($id)->select(); 
        $this->assign('dat',$data);//留言总数
        $this->display();
     }
      else{
      
        $this->error('非法操作哦！');
      }
   }           

   
}